package org.example.controller;

import org.example.domain.ResponseResult;
import org.example.domain.entity.User;
import org.example.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/user")
public class UserController {

    private final UserService userService;

    public UserController(UserService userService) {
        this.userService = userService;
    }



    @GetMapping("/userInfo")
    public ResponseResult userInfo(){

        return userService.userInfo();
    }


    @PostMapping("/register")
    public ResponseResult register(@RequestBody User user){

        return userService.register(user);

    }

    @PutMapping("/updateUser")
    public ResponseResult updateUser(@RequestBody User user){

        return userService.updateUser(user);
    }

}
